package org.cqu_proj.demo.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.Date;

@Document(collection = "user")  // MongoDB中的"User"集合
public class User {
    @Id
    private ObjectId id;  // ID
    private int userId ;//用户id

    @Indexed(unique = true)  // 为 userPhone 添加唯一索引
    private String userPhone;

    @Indexed(unique = true)  // 为 userEmail 添加唯一索引
    private String userEmail;

    private String userPassword;  // 用户密码

    private String userNickname;  // 用户昵称
    private String userGender = "未知";  // 默认性别为“未知”
    private String userIntroduce;  // 用户介绍
    private Date userRegisterTime;  // 注册时间
    private String userProfileUrl;  // 头像图片URL地址
    private Date userLastloginTime;  // 最近登录时间

    private String userBirthday;  // 用户生日

    private Date userModifyTime;  // 最近修改时间
    private String userRealname;  // 用户真实姓名

    // 默认构造函数
    public User() {}

    // 带参构造函数
    public User(String userEmail, String userPassword, String userPhone, String userNickname) {
        this.userEmail = userEmail;
        this.userPassword = userPassword;
        this.userPhone = userPhone;
        this.userNickname = userNickname;
        this.userRegisterTime = new Date();  // 注册时间为当前时间
    }

    // Getters and Setters


    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getUserBirthday() {
        return userBirthday;
    }

    public void setUserBirthday(String userBirthday) {
        this.userBirthday = userBirthday;
    }
    public String getUserEmail() {
        return userEmail;
    }

    public void setUserEmail(String userEmail) {
        this.userEmail = userEmail;
    }

    public String getUserPassword() {
        return userPassword;
    }

    public void setUserPassword(String userPassword) {
        this.userPassword = userPassword;
    }

    public String getUserPhone() {
        return userPhone;
    }

    public void setUserPhone(String userPhone) {
        this.userPhone = userPhone;
    }

    public String getUserNickname() {
        return userNickname;
    }

    public void setUserNickname(String userNickname) {
        this.userNickname = userNickname;
    }

    public String getUserGender() {
        return userGender;
    }

    public void setUserGender(String userGender) {
        this.userGender = userGender;
    }

    public String getUserIntroduce() {
        return userIntroduce;
    }

    public void setUserIntroduce(String userIntroduce) {
        this.userIntroduce = userIntroduce;
    }

    public Date getUserRegisterTime() {
        return userRegisterTime;
    }

    public void setUserRegisterTime(Date userRegisterTime) {
        this.userRegisterTime = userRegisterTime;
    }

    public String getUserProfileUrl() {
        return userProfileUrl;
    }

    public void setUserProfileUrl(String userProfileUrl) {
        this.userProfileUrl = userProfileUrl;
    }

    public Date getUserLastloginTime() {
        return userLastloginTime;
    }

    public void setUserLastloginTime(Date userLastloginTime) {
        this.userLastloginTime = userLastloginTime;
    }

    public Date getUserModifyTime() {
        return userModifyTime;
    }

    public void setUserModifyTime(Date userModifyTime) {
        this.userModifyTime = userModifyTime;
    }

    public String getUserRealname() {
        return userRealname;
    }

    public void setUserRealname(String userRealname) {
        this.userRealname = userRealname;
    }
}
